<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        /*<---实例一--->*/
        //基本数据类型存储
        var num1 = 20;
        var num2 = num1;
        num1 = 10;
        console.log(num1, num2);
        /*<---实例二--->*/
        //引用数据类型
        //1  2  指向同一个东西
        var obj1 = {"username":"zhangsan"};//obj1存放的是一个地址，指向堆区里的内容
        var obj2 = obj1;//obj2也指向obj1指向的内容
        obj2.username = "lisi";
        console.log(obj1.username);
        /*<---实例三--->*/
        var arr1 = [1,2,3,4,5];
        var arr2 = arr1;
        arr2[0] = 6;
        console.log(arr1[0]);
        //深拷贝 浅拷贝
        //==判断值  ===判断类型和值
        //引用类型判等 是判断内存空间是否相同 也就是地址
        var a = 6;
        function change(x){
            x=5;
        }
        change(a);
        console.log(a);
        //isNaN
        console.log(isNaN(a));
        var str = "ab-cd-ef-gh";
        console.log(str.slice(1,-1));
        console.log(str.slice(0,3));
        //将 - 作为分隔符 切开字符串 然后把切开的子串作为 相应的数组元素
        console.log(str.split("-"));

        //包装对象
        var strObject = new String(str);
        console.log(str.length,strObject.length);
    </script>
</body>
</html>